import { defineStore } from 'pinia'

interface UserInfo {
    id: number
    userId: string
    email: string
    roleId: number
    token?: string
    roles?: any[]
    permissions?: any[]
}

export const useUserInfoStore = defineStore('userInfo', {
    state: (): { userInfo: UserInfo | null } => ({
        userInfo: null
    }),
    actions: {
        setUserInfo(userInfo: UserInfo) {
            this.userInfo = userInfo
        },
        clearUserInfo() {
            this.userInfo = null
        }
    }
})
